# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-readability-lxml
pkgname=('python2-readability-lxml' 'python-readability-lxml')
_pkgname=readability-lxml
pkgver=0.8.4.1
pkgrel=1
pkgdesc='Fast html to text parser (article readability tool) with python3 support.'
arch=('any')
url='https://pypi.org/project/readability-lxml/#files'
license=('APACHE')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('a8d19b15d2f519fd65e2d5cf0c8bbe07a836a7bc2c338a3b5859a714a7111766c3dead98d2704d4aaf4561f706b2e11b35aef356df588a57fe4fe11eafc3f8f0')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-readability-lxml() {
  depends=('python2' 'python2-lxml')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-readability-lxml() {
  depends=('python' 'python-lxml')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

